#!/usr/bin/php
<?
set_include_path("../include");
require("header.inc.php");
require("../model/Error.inc.php");

if (!Z_ENV_DEV_SITE) {
	die("Test setup script can be run only on dev sites\n");
}

Zotero_DB::query("DELETE FROM libraries WHERE libraryID>3");
shell_exec("echo 'DELETE FROM zotero_www_test.users WHERE userID>2' | mysql -h 127.0.0.1 -P 3311 -u root");

shell_exec("killall memcached; /usr/local/bin/memcached -d");

$shards = array(1,2);
foreach ($shards as $shardID) {
	Zotero_DB::query("DELETE FROM shardLibraries WHERE libraryID>3", false, $shardID);
}

// Sample data for user 1
$itemObj = new Zotero_Item();
$itemObj->setField('libraryID', 1);
$itemObj->setField('key', "AAAA2222", false, true);
$itemObj->setField('itemTypeID', 2, false, true);
$itemObj->save();

// Sample data for user 2
$itemObj = new Zotero_Item();
$itemObj->setField('libraryID', 2);
$itemObj->setField('key', "BBBB2222", false, true);
$itemObj->setField('itemTypeID', 2, false, true);
$itemObj->save();

// Sample attachment for user 2
$itemObj = new Zotero_Item();
$itemObj->setField('libraryID', 2);
$itemObj->setField('key', "CCCC4444", false, true);
$itemObj->setField('itemTypeID', 14, false, true);
$itemID = $itemObj->save();

// Sample data for group 1
$itemObj = new Zotero_Item();
$itemObj->setField('libraryID', 3);
$itemObj->setField('key', "CCCC2222", false, true);
$itemObj->setField('itemTypeID', 2, false, true);
$itemObj->save();

// Sample attachment for group 1
$itemObj = new Zotero_Item();
$itemObj->setField('libraryID', 3);
$itemObj->setField('key', "CCCC3333", false, true);
$itemObj->setField('itemTypeID', 14, false, true);
$itemID = $itemObj->save();

?>
